<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/admin.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/main.css'); ?>">

<script language="JavaScript" src="<?php echo $this->_webroot('skin/js/jy.js'); ?>"></script>
<style>
td span {color:red;}
.green {color:green;}
.red {color:red;}
</style>
</head>
<body>
<input type="hidden" id="update_right" value="1" ></input>
<div id="maincontent">
<psp:tags     htmlname='messagebox'  iconname='messagebox' />
	<div class="wrap">
    <div class="crumbs">
		当前位置&gt;&gt; 
		商铺管理 &gt;&gt; 
		信用等级	</div>
        <hr />

	
		
	<div class="infobox">
   <h3>添加信用等级	<span class="right">
		<a href="<?php echo $this->_url('admin/integral/index');?>">商铺信用等级</a>
	</span></h3>
    <div class="content2">
<?php
$row =array('int_id'=>'','int_min'=>'','int_max'=>'','int_grade'=>'','int_img'=>'');
?>
		<form action="<?php echo $this->_url('admin/integral/add');?>" method="post"  enctype="multipart/form-data" onsubmit="return checkForm();">
		<table class="form-table">
			<tr>
				<td width="72px">级别：</td>
				<td><input id="credit_grade" class="small-text" type="text" name="data[int_grade]" value="<?php echo $row['int_grade']; ?>" style="width:200px;" /></td>
			</tr>
			<tr>
				<td>最小信用：</td>
				<td><input id="credit_min" class="small-text" type="text" name="data[int_min]" value="<?php echo $row['int_min']; ?>" style="width:200px;" /></td>
			</tr>
			<tr>
				<td>最大信用：</td>
				<td><input id="credit_max" class="small-text" type="text" name="data[int_max]" value="<?php echo $row['int_max']; ?>" style="width:200px;" /></td>
			</tr>
			<tr>
				<td>级别图显：</td>
				<td><input type="file" name="credit_img[]" />
					<input type="hidden" name="credit_img_old" value='<?php echo $row['int_img']; ?>' />
					<input type="hidden" name="id" value='<?php echo $row['int_id']; ?>' />
				</td>
			</tr>
			<tr><td colspan="2"><span class="button-container"><input class="regular-button" type="submit" name="submit" value="添加信用等级" /></span></td></tr>
		</table>
		</form>
	

	  </div>
	 </div>
	</div>
</div>
<script language="JavaScript">
<!--
function checkForm() {
	var credit_grade = document.getElementById("credit_grade").value;
	var credit_min = document.getElementById("credit_min").value;
	var credit_max = document.getElementById("credit_max").value;
	if(credit_grade==''){
		ShowMessageBox('级别不能为空！','0')
        return false;
    }
	if(credit_min==''){
		ShowMessageBox('最小信用值不能为空！','0')
        return false;
    }
	if(credit_max==''){
		ShowMessageBox('最大信用值不能为空！','0')
        return false;
    }
	var num_reg = /^(\d+)$/;
	// alert('aa');
	if(!num_reg.test(credit_grade)){
		ShowMessageBox('级别必须为数字！','0')
        return false;
    }
	if(!num_reg.test(credit_min)){
		ShowMessageBox('最小信用值必须为数字！','0')
        return false;
    }
	if(!num_reg.test(credit_max)){
		ShowMessageBox('最大信用值必须为数字！','0')
        return false;
    }
	if(parseInt(credit_min)>parseInt(credit_max)){
		ShowMessageBox('最小信用值要小于最大信用值！','0')
        return false;
    }
	
	return true;
}
//-->
</script>
</body>
</html>